import React,{Component} from 'react';
import {FlatList,Text,TouchableOpacity} from 'react-native'

export default class Demo18ListComponent extends Component{

  jump=(index)=>{
    console.log(this);
    //导航到detail地址所对应的组件
    this.props.navigation
    .navigate('detail',{id:index});
  }

  showListItem=(info)=>{
    return  <TouchableOpacity 
    onPress={()=>this.jump(info.index)}>
      <Text>{info.item}</Text>
    </TouchableOpacity>
  }

  render(){
    return <FlatList 
    renderItem={this.showListItem}
    data={[100,200,300]}></FlatList>
  }
}
